The maximum amount of memory allocated to a Dyalog APL workspace is defined by the maxws parameter (on non-Windows platforms this is defined by the environment variable MAXWS).
Upon )LOAD and )CLEAR, APL allocates an amount of memory corresponding to the size of the workspace being loaded (which is zero for a clear ws) plus the workspace delta.
The workspace delta is 1/16th of maxws, except if there is less than 1/16th of maxws in use, delta is 1/64th of maxws. This may also be expressed as follows:
delta←maxws{⌈⍺÷⊃(⍵>⍺÷16)⌽64 16}ws
where maxws is the value of the maxws parameter and ws is the currently allocated amount of workspace. If maxws is 16384KB, the workspace delta is either 256KB or 1024 KB, and when you start with a clear ws the workspace occupies 256KB.
When you erase objects or release symbols, areas of memory become free. APL manages these free areas, and tries to reuse them for new objects. If an operation requires a contiguous amount of workspace larger than any of the available free areas, APL reorganises the workspace and amalgamates all the free areas into one contiguous block as follows:
Note that if you try to create an object which is larger than free space, APL reports WS FULL.
The following system function and commands force a workspace reorganisation as described above:
⎕WA, )RESET, )SAVE, )LOAD, )CLEAR
However, in contrast to the above, any spare workspace above the workspace delta is returned to the Operating System. On a Windows system, you can see the process size changing by using Task Manager.
The system function ⎕WA may therefore be used judiciously (workspace reorganisation takes time) to reduce the process size after a particularly memory-hungry operation.
Note that in Dyalog APL, the SYMBOL TABLE is entirely dynamic and grows and shrinks in size automatically. There is no SYMBOL TABLE FULL condition.
Additional functions for managing the memory used by the workspace are described in Memory Manager Statistics and Specify Workspace Available.